package ru.arriah.servicedesk.bean;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import ru.arriah.common.bean.GenericBean;

public class TaskBean extends GenericBean {

   private String name;
   private int requestId;
   private int employeeId;
   private int statusId;
   private String text;
   private String executorReport;
   private Date startDate;
   private Date endDate;
   private Date approxEndDate;
   private EmployeeBean executor;
   private TaskStatusBean status;
   private int priority;
   private RequestPriorityBean priorityBean;
   private int color;
   
   private Date searchFromStartDate;
   private Date searchToStartDate;
   private Date searchFromEndDate;
   private Date searchToEndDate;
      

   public TaskBean() {
      super();
   }
   
   public TaskBean(ResultSet resultSet) {
      fillFromResultSet(resultSet);
   }
   
   @Override
   public void fillFromResultSet(ResultSet resultSet) {
      try {
         setId(resultSet.getInt("task.id"));
         setName(resultSet.getString("task.name"));
         setRequestId(resultSet.getInt("task.request_id"));
         setEndDate(resultSet.getDate("task.enddate"));
         setApproxEndDate(resultSet.getDate("task.approxEndDate"));
         setStartDate(resultSet.getDate("task.startdate"));
         setExecutorReport(resultSet.getString("task.executorreport"));
         setText(resultSet.getString("task.text"));
         setEmployeeId(resultSet.getInt("task.employee_id"));
         setStatusId(resultSet.getInt("task.status_id"));
         setPriority(resultSet.getInt("task.priority"));         
      } catch (SQLException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }

   public int getColor() {
      return color;
   }

   public void setColor(int color) {
      this.color = color;
   }

   public RequestPriorityBean getPriorityBean() {
      return priorityBean;
   }

   public void setPriorityBean(RequestPriorityBean priorityBean) {
      this.priorityBean = priorityBean;
   }

   public int getPriority() {
      return priority;
   }

   public void setPriority(int priority) {
      this.priority = priority;
   }

   public int getEmployeeId() {
      return employeeId;
   }

   public void setEmployeeId(int employeeId) {
      this.employeeId = employeeId;
   }

   public Date getEndDate() {
      return endDate;
   }

   public void setEndDate(Date endDate) {
      this.endDate = endDate;
   }

   public EmployeeBean getExecutor() {
      return executor;
   }

   public void setExecutor(EmployeeBean executor) {
      this.executor = executor;
   }

   public String getExecutorReport() {
      return executorReport;
   }

   public void setExecutorReport(String executorReport) {
      this.executorReport = executorReport;
   }

   public int getRequestId() {
      return requestId;
   }

   public void setRequestId(int requestId) {
      this.requestId = requestId;
   }

   public Date getStartDate() {
      return startDate;
   }

   public void setStartDate(Date startDate) {
      this.startDate = startDate;
   }

   public TaskStatusBean getStatus() {
      return status;
   }

   public void setStatus(TaskStatusBean status) {
      this.status = status;
   }

   public int getStatusId() {
      return statusId;
   }

   public void setStatusId(int statusId) {
      this.statusId = statusId;
   }

   public String getText() {
      return text;
   }

   public void setText(String text) {
      this.text = text;
   }

   public Date getApproxEndDate() {
      return approxEndDate;
   }

   public void setApproxEndDate(Date approxEndDate) {
      this.approxEndDate = approxEndDate;
   }
   
   public Date getSearchFromEndDate() {
      return searchFromEndDate;
   }

   public void setSearchFromEndDate(Date searchFromEndDate) {
      this.searchFromEndDate = searchFromEndDate;
   }

   public Date getSearchFromStartDate() {
      return searchFromStartDate;
   }

   public void setSearchFromStartDate(Date searchFromStartDate) {
      this.searchFromStartDate = searchFromStartDate;
   }

   public Date getSearchToEndDate() {
      return searchToEndDate;
   }

   public void setSearchToEndDate(Date searchToEndDate) {
      this.searchToEndDate = searchToEndDate;
   }

   public Date getSearchToStartDate() {
      return searchToStartDate;
   }

   public void setSearchToStartDate(Date searchToStartDate) {
      this.searchToStartDate = searchToStartDate;
   }

   @Override
   public boolean isValid() {
      // TODO Auto-generated method stub
      return false;
   }

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }
}